package com.ruiyian.bridge.info.service.impl;

import com.ruiyian.bridge.info.mapper.TemperatureMapper;
import com.ruiyian.bridge.info.service.TemperatureService;
import com.ruiyian.bridge.project.domain.vo.DataAnalysisDto;
import com.ruiyian.bridge.project.domain.vo.DataAnalysisVo;
import com.ruiyian.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author chong
 * @email 673426164@qq.com
 * @create 2022/6/17
 * Desc: 温度传感器
 */
@Service
public class TemperatureServiceImpl implements TemperatureService {

    @Autowired
    private TemperatureMapper temperatureMapper;


    @Override
    public DataAnalysisVo getNowMinData(String addr, String macaddr) {
        String now = DateUtils.dateTimeNow();
        String nextDate = DateUtils.getNextDate(2, new Date(), -8, null);
        return temperatureMapper.getNowMinData(addr,macaddr,nextDate,now);
    }
    /**
     * 温度同期对比
     * @param dto
     * @return
     */
    @Override
    public List<DataAnalysisVo> querySameTempByDateType(DataAnalysisDto dto) {
        return temperatureMapper.querySameTempByDateType(dto);
    }
}
